//
//  scrollViewOfImage.m
//  mintHome
//
//  Created by 朱彦名 on 16/6/17.
//  Copyright © 2016年 朱彦名. All rights reserved.
//

#import "scrollViewOfImage.h"

@implementation scrollViewOfImage


- (instancetype)initWithFrame:(CGRect)frame withImage: (NSArray <UIImage *>*)images delegate: (id)delegate{
    self = [super initWithFrame:frame];
    if (self) {
        [self configWithFrame:frame withImage:images delegate:delegate];
        
    }
    return self;

}
- (void)configWithFrame: (CGRect)frame withImage: (NSArray *)images delegate: (id) delegate{

    self.contentSize = CGSizeMake(frame.size.width * images.count, frame.size.height);
    
    for (int i = 0 ; i < images.count; i++) {
//        self = [[scrollViewOfImage alloc]initWithFrame:CGRectMake(frame.size.width * i, 0, frame.size.width, frame.size.height)];
//        
//        self.delegate = delegate;
        
        UIImageView *imageOfAlbum = [[UIImageView alloc] initWithImage:images[i]];
        
        imageOfAlbum.frame = CGRectMake(frame.size.width * i, 0, frame.size.width, frame.size.height);
        [self addSubview:imageOfAlbum];
        
        [imageOfAlbum release];
        
    }
    self.bounces = YES;
    
    self.pagingEnabled = YES;
    

    

}

@end
